cmake_minimum_required(VERSION 3.12.0)
project(AudioRecorder)

set(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/<CONFIG>)

find_package(spdlog CONFIG REQUIRED
    PATHS lib/spdlog
    NO_CMAKE_PACKAGE_REGISTRY
)
message(STATUS "Using spdlog: ${spdlog_VERSION} ${spdlog_DIR}")

find_package(rtaudio CONFIG REQUIRED
    PATHS lib/rtaudio
    NO_CMAKE_PACKAGE_REGISTRY
)
message(STATUS "Using rtaudio: ${rtaudio_VERSION} ${rtaudio_DIR}")

set(FFMPEG_ROOT "D:\\Libs\\ffmpeg-4.3.2-2021-02-02-full_build-shared")
find_package(FFMPEG CONFIG REQUIRED
    COMPONENTS avformat avcodec avutil swresample swscale
    HINTS cmake
)
message(STATUS "Using FFmpeg: ${FFMPEG_VERSION} ${FFMPEG_DIR}")

add_executable(${PROJECT_NAME}
    main.cpp
)

target_compile_options(${PROJECT_NAME}
    PRIVATE /execution-charset:utf-8
)

target_link_libraries(${PROJECT_NAME}
    PRIVATE RtAudio::rtaudio
    PRIVATE spdlog::spdlog
    PRIVATE FFMPEG::avutil
)

set_property(TARGET ${PROJECT_NAME}
    PROPERTY VS_DEBUGGER_ENVIRONMENT PATH=%PATH%;$<TARGET_FILE_DIR:spdlog::spdlog>
)